<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>作用域插槽</title>
  </head>
  <body>
    <script src="https://unpkg.com/vue@next"></script>
    <div id="root"></div>

    <script>
      const app = Vue.createApp({
        data() {
          return {
            text: "我的按钮",
          };
        },
        template: `
                   <list v-slot="{item}">
                        <p>{{item}}</p>    
                   </list> 

                `,
      });

      app.component("list", {
        data() {
          return {
            list: [1, 2, 3, 4, 5, 6],
          };
        },
        template: ` 
                <div>
                    <slot v-for="item in list" :item="item"/> 
                </div>
                   
        `,
      });

      const vm = app.mount("#root");
    </script>
  </body>
</html>
